package com.xxkfz.controller;

import com.xxkfz.aspect.repeat.RepeatSubmit;
import com.xxkfz.entity.UserEntity;
import com.xxkfz.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @program: xxkfz-admin-redisson
 * @ClassName RepeatSubmitController.java
 * @author: wust
 * @create: 2024-04-11 16:55
 * @description:
 **/
@RestController
@Slf4j
@RequestMapping("/repeat")
public class RepeatSubmitController {


    @PostMapping("submit")
    @RepeatSubmit(message = "不可重复提交，请稍后再试!", interval = 6000)
    public Result<Object> testSubmit(@RequestBody UserEntity userEntity) {
        log.error("开始处理业务：userEntity = {}", userEntity);
        try {
            // 模拟业务处理3s
            Thread.sleep(3000);
        } catch (InterruptedException ex) {
        }
        log.error("业务处理完成......");
        return Result.success("提交成功", userEntity);
    }
}